﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

namespace Armon.Lib.Web.Filters
{
    public class HttpResponseExceptionFilter : IExceptionFilter
    {
        public void OnException(ExceptionContext context)
        {
            var result = new
            {
                context.Exception.Message,
                Success = false
            };
            context.Result = new ObjectResult(result);
            context.ExceptionHandled = true;
        }
    }
}
